package com.seaboxdata.util;

import com.mongodb.MongoClient;
import com.mongodb.client.result.UpdateResult;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update;

/**
 * @author
 * @create 2021-04-27 10:23
 **/
public class Test {
    public static void main(String[] args) {
        MongoClient mClient = new MongoClient("172.21.17.51",30002);
        MongoTemplate mongoTemplate = new MongoTemplate(mClient,"mds_server_deploy");
        Query updateQuery = new Query(Criteria.where("db_type").is("MYSQL"));
        UpdateResult updateResult = mongoTemplate.updateMulti(updateQuery, Update.update("schema", "mysql"), "mds_object");
        System.out.println(updateResult);
    }
}
